﻿<template>
  <el-form
    ref="editForm"
    label-width="120px"
    :model="entity"
    :rules="formRule"
  >

    <el-form-item
      :label="L('ReceiverId')"
      prop="ReceiverId"
    >
      <el-input
        v-model="entity.receiverId"
        :maxlength="32"
        :minlength="2"
      />
    </el-form-item>
    <el-form-item
      :label="L('TaskContent')"
      prop="TaskContent"
    >
      <el-input
        v-model="entity.taskContent"
        :maxlength="32"
        :minlength="2"
      />
    </el-form-item>

  </el-form>
</template>
<script>
export default {
  name: 'CreateOrEdit',
  props: {
    entity: {
      type: Object,
      default: () => { return {} }
    }
  },
  data() {
    return {
      editEntity: {},
      formRule: {

        receiverId: [{ required: true, message: this.L('FieldIsRequired', undefined, this.L('ReceiverId')), trigger: 'blur' }],

        taskContent: [{ required: true, message: this.L('FieldIsRequired', undefined, this.L('TaskContent')), trigger: 'blur' }],
        a: []
      }
    }
  },
  watch: {
    entity(val) {
      // if (val.id) {
      //   for (var e in this.entity) {
      //     this.entity[e] = null
      //   }
      // }
    }
  },
  created() {
  },
  methods: {
    clearValidate() {
      this.$refs.editForm.clearValidate()
    },
    validate(cb) {
      this.$refs.editForm.validate(cb)
    }
  }
}
</script>
